package com.shawn.integeration.batch.file.writer;

import com.shawn.integeration.business.student.mapper.StudentMapper;
import com.shawn.integeration.business.student.model.Student;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author shawn
 * @description: 学生信息写入器
 * @date 2024/1/13
 */
@Component
public class StudentItemWriter implements ItemWriter<Student> {

    @Resource
    private StudentMapper mapper;

    @Override
    public void write(List<? extends Student> list) throws Exception {
        mapper.batchInsert(list);
    }
}
